# utf-8


login_flag = False
def login_verify(fn):
    def inner(*args, **kwargs):
        global login_flag
        # 完成登录验证
        if login_flag == False:
            print("还未完成登录操作！")
            while 1:
                username = input("请输入用户名：")
                password = input("请输入密码：")
                if username == "zkk" and password == "123":
                    print("登录成功！")
                    login_flag = True
                    break
                else:
                    print("登录失败，账号密码错误！")
        # 此步是if成功后跳出循环执行目标函数，否则不能改写login_flag的状态一直在重新登录中循环
        ret = fn(*args, **kwargs)
        return ret
    return inner

@login_verify
def add():
    print("添加信息")

@login_verify
def delete():
    print("删除信息")

@login_verify
def up():
    print("修改信息")


@login_verify
def selete():
    print("查询信息")

add()
delete()
up()
selete()